register

inline fun <C : Callback> Advisable<in C>.register(callback: C): C?
inline fun <C : Callback> Advisable<in C>.register(callback: C): C?

Registers the given callback in this Advisable.

This method would replace the previously registered callback of type C, if any.

Please note, this method can't be called without an explicit specifying of the lambda type. Kotlin compiler does not recognize functional interfaces as function types in generic signatures. This is a known bug.

Consider the following snippet:

// The function can't be called as the following:
register<InjectCssCallback> { inject("body { background-color: orange; }") }

// One have to specify lambda's type explicitly:
register(InjectCssCallback { inject("body { background-color: orange; }") })

Return

the previously registered callback

Since

8.0.0

See also